<?php
/**
 * 功能: PhpStorm.
 * User: 文丹
 * Date: 2018/5/16 0016
 * Time: 16:36
 */

namespace app\validate;
use think\Exception;
use think\Request;
use think\Validate;

class BaseValidate extends Validate{
    public function goCheck(){
        /**
         *  获取http传入的参数
         * 对这些参数做校验
         */
        $request = Request::instance();//取当前http的请求信息
        $params  = $request->param();//获取全部请求参数（name,age....）
        $result  = $this->batch()->check($params);
        if(!$result){
            $error = $this->error;
            $msg   = implode(',',$error);
            /*dump($msg);
            dump($error);*/
           return json(['msg'=>$msg,'ok'=>false]);
        }else{
            return false;
        }
    }

}